
<template>
    <van-button type="primary" @click="_switchFragment(1)">切换到fragment1</van-button>
    <van-button type="primary" @click="_switchFragment(2)">切换到fragment2</van-button>
    <div class="testBg">这是main</div>
    <router-view v-slot="{ Component }">
        <keep-alive>
            <component :is="Component" />
        </keep-alive>
    </router-view>
    <!-- <RouterView /> -->
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router'
let router = useRouter()
let _switchFragment = (index: number) => {
    if (index == 1) {
        router.push({
            name: 'MainFra1'
        })
    } else {
        router.push({
            name: 'MainFra2'
        })
    }

}
</script>